package com.zxd.generics_class;

/**
 * ClassName:MyArrayList
 * Package:com.zxd.generics_class
 *
 * @Date:2023/9/22 11:06
 * @Author:zxde
 */
public class MyArrayList<E> {
    private Object[] data = new Object[10];
    private int size = 0;

    public int getSize(){
        return size;
    }
    public boolean add(E e){
        try {
            data[size++] = e;
            return true;

        }catch (Exception exception){
            exception.printStackTrace();
            return false;
        }
    }

    public E get(int index){
        try {
            return (E) data[index];
        }catch (Exception e){
            return null;
        }
    }
}
